package com.lottery.game.core.modules.entity.user;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.lottery.game.common.BaseObject;

import java.util.Date;
import java.util.List;
import java.util.Map;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @Author: zwei
 * @Date: 2018/8/29
 * @Description:
 */
@Data
//@JsonFilter("gameAgentFilter")
@ApiModel(value = "GameAgent", description = "代理用户")
public class GameAgent extends BaseObject {

	@ApiModelProperty(value = "id", name = "id", example = "4782394714614619")
	@JsonProperty("id")
	private String id;

	/**
	 * Description:昵称
	 */
	@ApiModelProperty(value = "username", name = "用户名", example = "fancies")
	@JsonProperty("username")
	private String username;

	/**
	 * Description:账号
	 */
	@ApiModelProperty(value = "phone", name = "账号", example = "13600227731")
	@JsonProperty("phone")
	private String phone;

	/**
	 * Description:代理状态【默认0,0非代理;1代理】
	 */
	@ApiModelProperty(value = "agent", name = "代理状态", example = "0")
	private String agent;

	/**
	 * Description:上级
	 */
	@ApiModelProperty(value = "superiors", name = "上级", example = "42335452362363")
	private String superiors;

	/**
	 * Description:排序编号
	 */
	@ApiModelProperty(value = "gameusernumber", name = "排序编号")
	private Integer gameusernumber;

	/**
	 * Description:最后登入时间
	 */
	@ApiModelProperty(value = "loginTime", name = "最后登入时间")
	private String loginTime;

	/**
	 * Description:头像路径
	 */
	@ApiModelProperty(value = "photourl", name = "头像路径")
	private String photourl;

	/**
	 * 余额
	 */
	@ApiModelProperty(value = "balance", name = "余额")
	@JsonProperty("balance")
	private String balance;

	@ApiModelProperty(value = "agentDate", name = "代理日期")
	@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
	@JsonProperty("agentDate")
	private Date agentDate;

	/**
	 * Description:以下数据与数据库无关
	 * Description:旗下代理
	 */
	@ApiModelProperty(value = "lowerAgent", name = "旗下代理")
	@JsonProperty("lowerAgent")
	List<GameAgent> lowerAgent;

	/**
	 * Description:旗下投注流水
	 */
	@ApiModelProperty(value = "pouringWater", name = "旗下投注流水")
	@JsonProperty("pouringWater")
	private Double pouringWater;

	/**
	 * Description:旗下盈亏 = 获励 - 投注流水
	 */
	@ApiModelProperty(value = "profit", name = "旗下盈亏")
	@JsonProperty("profit")
	private Double profit;

	/**
	 * Description:旗下充值
	 */
	@ApiModelProperty(value = "recharge", name = "旗下充值")
	@JsonProperty("recharge")
	private Double recharge;

	/**
	 * Description:旗下获利
	 */
	@ApiModelProperty(value = "bonus", name = "旗下获利")
	private Double bonus;

	/**
	 * Description:旗下总余额
	 */
	@ApiModelProperty(value = "balanceCount", name = "旗下总余额")
	private Double balanceCount;

	/**
	 * Description:删除标记
	 */
	@ApiModelProperty(value = "delFlag", name = "删除标记")
	private String delFlag;

	/**
	 * Description:更新用户旗下的流水/盈亏/充值
	 *
	 * @param statistics
	 */
	public void setStatistics(Map<String, Double> statistics) {
		this.pouringWater = statistics.get("pouringWater");
		this.profit = statistics.get("profit");
		this.recharge = statistics.get("recharge");
		this.bonus = statistics.get("bonus");
		this.balanceCount = statistics.get("balanceCount");
	}

}
